{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "41ac7c23-62a1-4577-a552-cc6e1ce18a03",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/conda/lib/python3.9/site-packages/scipy/__init__.py:146: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.24.1\n",
      "  warnings.warn(f\"A NumPy version >={np_minversion} and <{np_maxversion}\"\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "expand(f,M_list,out_folder) 文档:\n",
      "    ----------------------\n",
      "            f :   需要处理的图像文件名\n",
      "        M_list :  一个字符串列表，包含需要进行的所有的变换:\n",
      "    out_folder :  输出文件夹名\n",
      "    ----------------------\n",
      "    M_list 可用变换包括(重复录入无效):\n",
      "    - \"10\",\"-10\",\"30\",\"-30\",\"90\",\"-90\" -> 整数表示(视觉上)顺时针旋转，负数反之\n",
      "    - \"lr\",\"ud\",\"ct\" -> 分别表示左右翻转(绕y轴), 上下翻转(绕x轴)，绕圆心翻转\n",
      "    - \"sh30\",\"sh-45\" -> 分别表示剪切的操作，角度为与y轴的夹角，正值表示前倾/，负值则表示后仰\n",
      "    - \"T\" -> 转置\n",
      "处理进度: 100%: ▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋\n",
      "完成进行的操作 ['10', '-10', '30', '-30']\n",
      "所有的输出文件都被保存在 /home/jovyan/work/图像处理/利用仿射变换图像集扩充/输出文件夹1\n",
      "处理进度: 100%: ▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋▋\n",
      "完成进行的操作 ['10', '-10', '30', '-30', '90', '-90', 'lr', 'ud', 'ct', 'sh30', 'sh-45', 'T']\n",
      "所有的输出文件都被保存在 /home/jovyan/work/图像处理/利用仿射变换图像集扩充/输出文件夹2\n"
     ]
    }
   ],
   "source": [
    "####################################\n",
    "# 注意: 请直接运行此文件中代码，不要修改 #\n",
    "####################################\n",
    "\n",
    "import preprocess as pp\n",
    "\n",
    "print(pp.expand.__doc__)  # 首先打印方法文档\n",
    "\n",
    "M_list_1 = [\"10\", \"-10\", \"30\", \"-30\"]\n",
    "pp.expand('dog.jpg', M_list_1, '输出文件夹1')\n",
    "\n",
    "M_list_2 = [\"10\", \"-10\", \"30\", \"-30\", \"90\", \"90\",\n",
    "            \"90\", \"90\", \"-90\", \"lr\", \"ud\", \"ct\",\n",
    "            \"sh30\", \"sh-45\", \"T\"]\n",
    "pp.expand('dog.jpg', M_list_2, '输出文件夹2')\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
